package com.best.oasis.settlement.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class CreateConnnection {
	private static String driverClassName = "oracle.jdbc.OracleDriver";
	private static String connectionUrl = "jdbc:oracle:thin:@172.18.8.31:1521:OASISUTF";
	private static String username="settlementtest";
	private static String password="orasettlementtest";
	
	private Connection con = null;
	
	public Connection getConnection(){
		try {
			if(con == null){
				Class.forName(driverClassName);
				con = DriverManager.getConnection(connectionUrl, username, password);
				con.setAutoCommit(false);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}
		return con;
	}
	
	public void close(){
		try {
			con.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
}
